package com.dotflat.staffExtend.domain;

import com.dotflat.rest.domain.AreableObjectBase;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Entity
@Table(name = "ex_staff_extend_info", uniqueConstraints = {@UniqueConstraint(columnNames = {"staffId", "areaId"})})
@Data
@EqualsAndHashCode(callSuper = true)
public class StaffExtendInfo extends AreableObjectBase {
//	private String realName;
//	private String mobile;
//	private Integer gender;
//	private String headImgUrl;
	@Column(columnDefinition = "varchar(32)  COMMENT '员工id'", nullable = false)
	private String staffId;

	@Column(columnDefinition = "int(3) DEFAULT 0 COMMENT '编号' ")
	private Integer seq = 0;

	@Column(columnDefinition = "varchar(20)  COMMENT '部门'")
	private String department;

	@Column(columnDefinition = "varchar(20)  COMMENT '岗位'")
	private String position;

	@Column(columnDefinition = "datetime COMMENT '生日'")
	private Date birthday;

	@Column(columnDefinition = "datetime default NOW() COMMENT '入职日期'")
    private Date joinAt = new Date();

	//离职日期
	private Date resignDate;

	@Column(columnDefinition = "datetime default NOW() COMMENT '转正日期'")
	private Date fullAt = new Date();

	@Column(columnDefinition = "varchar(24)  COMMENT '身份证号'")
	private String idCard;

	@Column(columnDefinition = "varchar(128)  COMMENT '户籍地址'")
	private String idCardAddress;

	@Column(columnDefinition = "varchar(32)  COMMENT '邮箱地址'")
	private String email;

	@Column(columnDefinition = " int(3) DEFAULT 0 COMMENT '婚姻状况 0：未知，1.未婚，2.已婚，3.离异，4丧偶' ")
	private Integer marriage = 0;

	@Column(columnDefinition = "varchar(128)  COMMENT '居住地址'")
	private String address;

	@Column(columnDefinition = "varchar(128)  COMMENT '擅长，竖线分割'")
	private String goodAt;

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "staffExtendInfo")
	@OrderBy("created DESC")
	private List<StaffExtendHealthy> healthies;

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "staffExtendInfo")
	@OrderBy("created DESC")
	private List<StaffExtendCareer> careers;

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "staffExtendInfo")
	@OrderBy("created DESC")
	private List<StaffExtendLicense> licenses;

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "staffExtendInfo")
	@OrderBy("created DESC")
	private List<StaffExtendRelation> relations;

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "staffExtendInfo")
	@OrderBy("created DESC")
	private List<StaffExtendVaccine> vaccines;

}
